package ControlLayer;

import ModelLayer.CustomerRecords;
import ModelLayer.ContractorRecords;
import ModelLayer.EmployeeRecords;
import ModelLayer.Customer;
import ModelLayer.Contractor;
import ModelLayer.Employee;
import ModelLayer.RealException;
import java.util.ArrayList;

public class PersonCtr {
	
private CustomerRecords customerRecords;
private ContractorRecords contractorRecords;
private EmployeeRecords employeeRecords;
	
	public PersonCtr() {
		customerRecords = CustomerRecords.getInstance();
		contractorRecords = ContractorRecords.getInstance();
		employeeRecords = EmployeeRecords.getInstance();
	}
	
	public void createCustomer(String name, String address, long phone, int group) throws RealException
	{
		customerRecords.addCustomer(name, address, phone, group);
	}
	
	public Customer getCustomer(int id) throws RealException {
		return customerRecords.getCustomer(id);	
	}
	
	public void updateCustomer(int id, int fieldID, String value) throws RealException {
		customerRecords.updateCustomer(id, fieldID, value);
	}
	
	public void deleteCustomer(int id) throws RealException {
		customerRecords.removeCustomer(id);
	}
	
	public String printCustomer(int id) throws RealException
	{
		return customerRecords.printCustomer(id);
	}
	
	public ArrayList<String> getAllCustomers() {
		return customerRecords.getAllCustomers();
	}
	
	public void checkCustomer(int id) throws RealException {
		customerRecords.checkCustomer(id);	
	}
	
	
	
	
	public void createContractor(String name, String address, long phone)
	{
		contractorRecords.addContractor(name, address, phone);
	}
	
	public Contractor getContractor(int id) throws RealException {
		return contractorRecords.getContractor(id);	
	}
	
	public void updateContractor(int id, int fieldID, String value) throws RealException {
		contractorRecords.updateContractor(id, fieldID, value);
	}
	
	public void deleteContractor(int id) throws RealException {
		contractorRecords.removeContractor(id);
	}
	
	public String printContractor(int id) throws RealException
	{
		return contractorRecords.printContractor(id);
	}
	
	public ArrayList<String> getAllContractors() {
		return contractorRecords.getAllContractors();
	}
	
	public void checkContractor(int id) throws RealException {
		contractorRecords.checkContractor(id);	
	}
	
	
	
	
	public void createEmployee(String name, String address, long phone, String password, String position)
	{
		employeeRecords.addEmployee(name, address, phone, password, position);
	}
	
	public Employee getEmployee(int id) throws RealException {
		return employeeRecords.getEmployee(id);	
	}
	
	public void updateEmployee(int id, int fieldID, String value) throws RealException {
		employeeRecords.updateEmployee(id, fieldID, value);
	}
	
	public void deleteEmployee(int id) throws RealException {
		employeeRecords.removeEmployee(id);
	}
	
	public String printEmployee(int id) throws RealException
	{
		return employeeRecords.printEmployee(id);
	}
	
	public ArrayList<String> getAllEmployees() {
		return employeeRecords.getAllEmployees();
	}	
	
	public int login(String name, String password) throws RealException
	{
		return employeeRecords.login(name, password);
	}
	
	public int loginGUI(String name, char[] password) throws RealException
	{
		return employeeRecords.loginGUI(name, password);
	}

	public int getTotalEmployees() {
		return employeeRecords.getTotalEmployees();
	}
	
	public void checkEmployee(int id) throws RealException {
		employeeRecords.checkEmployee(id);	
	}

	public String getEmployeePosition(int loggedEmployeeId) throws RealException {
		return employeeRecords.getEmployeePosition(loggedEmployeeId);
	}
}

